package com.lanou3g.demo.role.service;

import com.lanou3g.demo.entity.ExRoleinfo;
import com.lanou3g.demo.entity.RoleInfo;
import com.lanou3g.demo.entity.RoleModule;
import com.lanou3g.demo.mapper.RoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleService implements IRoleService {
    @Autowired
    private RoleMapper roleMapper;

    @Override
    public List<ExRoleinfo> findAll(int start) {
        return roleMapper.findAll(start);
    }

    @Override
    public ExRoleinfo findTotal() {
        return roleMapper.findTotal();
    }

    @Override
    public boolean deleteOne(int roleId) {
        return roleMapper.deleteOne(roleId);
    }

    @Override
    public boolean deleteMiddle(int roleId) {
        return roleMapper.deleteMiddle(roleId);
    }

    @Override
    public int insertRoleInfo(String name) {
        return roleMapper.insertRoleInfo(name);
    }

    @Override
    public int insertRoleModule(Integer roleId,List<Integer> moduleId) {
        return roleMapper.insertRoleModule(roleId,moduleId);
    }

    @Override
    public RoleInfo selectNameById(String name) {
        return roleMapper.selectNameById(name);
    }

    @Override
    public int updateName(int roleId, String name) {
        return roleMapper.updateName(roleId,name);
    }

    @Override
    public RoleModule findAllModule(int roleId) {
        return roleMapper.findAllModule(roleId);
    }

    @Override
    public int insertModule(int roleId, List<Integer> moduleId) {
        return roleMapper.insertModule(roleId, moduleId);
    }

    @Override
    public boolean deleteModule(int roleId, List<Integer> moduleId) {
        return roleMapper.deleteModule(roleId, moduleId);
    }
}
